package com.me.generateXML;

public class Table {

	private String tableName;

	private String domainObjectName;

	private String mapperName;

	private boolean enableCountByExample;

	private boolean enableUpdateByExample;

	private boolean enableDeleteByExample;

	private boolean enableSelectByExample;

	private boolean selectByExampleQueryId;

	public Table() {
		super();
	}

	public Table(String tableName) {
		this.tableName = tableName;
		this.enableCountByExample = true;
		this.enableDeleteByExample = true;
		this.enableSelectByExample = true;
		this.enableUpdateByExample = true;
		this.selectByExampleQueryId = true;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getDomainObjectName() {
		return domainObjectName;
	}

	public void setDomainObjectName(String domainObjectName) {
		this.mapperName = null;
		this.domainObjectName = domainObjectName;
	}

	public String getMapperName() {
		return mapperName;
	}

	public void setMapperName(String mapperName) {
		this.domainObjectName = null;
		this.mapperName = mapperName;
	}

	public boolean isEnableCountByExample() {
		return enableCountByExample;
	}

	public void setEnableCountByExample(boolean enableCountByExample) {
		this.enableCountByExample = enableCountByExample;
	}

	public boolean isEnableUpdateByExample() {
		return enableUpdateByExample;
	}

	public void setEnableUpdateByExample(boolean enableUpdateByExample) {
		this.enableUpdateByExample = enableUpdateByExample;
	}

	public boolean isEnableDeleteByExample() {
		return enableDeleteByExample;
	}

	public void setEnableDeleteByExample(boolean enableDeleteByExample) {
		this.enableDeleteByExample = enableDeleteByExample;
	}

	public boolean isEnableSelectByExample() {
		return enableSelectByExample;
	}

	public void setEnableSelectByExample(boolean enableSelectByExample) {
		this.enableSelectByExample = enableSelectByExample;
	}

	public boolean isSelectByExampleQueryId() {
		return selectByExampleQueryId;
	}

	public void setSelectByExampleQueryId(boolean selectByExampleQueryId) {
		this.selectByExampleQueryId = selectByExampleQueryId;
	}

	@Override
	public String toString() {
		String str = "<table tableName=" + "\"" + tableName + "\"";

		if (null != mapperName && null == domainObjectName) {
			str += "  mapperName=" + "\"" + mapperName + "\"";
		} else if (null == mapperName && null != domainObjectName) {
			str += "  domainObjectName=" + "\"" + domainObjectName + "\"";
		}
		str += "  enableCountByExample=" + "\"" + enableCountByExample + "\"" + "  enableUpdateByExample=" + "\""
				+ enableUpdateByExample + "\"" + "  enableDeleteByExample=" + "\"" + enableDeleteByExample + "\""
				+ "  enableSelectByExample=" + "\"" + enableSelectByExample + "\"" + "  selectByExampleQueryId=" + "\""
				+ selectByExampleQueryId + "\"" + "/>";

		return str;
	}

}
